package miracle.joker.design.memento;

import java.util.Stack;

public class Caretaker {
    private Stack<Memento> history = new Stack<>();

    public void addMemento(Memento m) {
        history.push(m);
    }

    public Memento getMemento() {
        if (!history.isEmpty()) {
            return history.pop();
        }
        return null;
    }
}
